﻿using System.Data;
using DTO;

namespace DAO
{
    public class ChatLieu_Dao 
    {
        private readonly BaseOperationImplement<ChatLieu_Dto> _chatLieuImp = new BaseOperationImplement<ChatLieu_Dto>();

        public DataTable GetAllObject()
        {
            return _chatLieuImp.GetAllObject("ChatLieu");
        }

        public int AddObject(ChatLieu_Dto obj)
        {
            return _chatLieuImp.AddObject("insChatLieu", CommandType.StoredProcedure,
                                          "@id", obj.MaChatLieu, "@tencl", obj.TenChatLieu);
        }

        public int EditObject(string id, ChatLieu_Dto newObj)
        {
            return _chatLieuImp.EditObject("editChatLieu", CommandType.StoredProcedure,
                                           "@id", id, "@tencl", newObj.TenChatLieu);
        }

        public int DeleteObject(string id)
        {
            return _chatLieuImp.EditObject("delChatLieu", CommandType.StoredProcedure, "@id", id);
        }

        public int AutoIncrementIdObject()
        {
            return _chatLieuImp.AutoIncrementIdObject("ChatLieu", "MaChatLieu");
        }
    }
}